package com.example.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class MyActivity extends Activity implements OnClickListener
{
	private MyView myView;
	private Button mButton;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		show_layout_01();
	}
	
	public void show_layout_01()
	{
		LinearLayout layout = new LinearLayout(this);
		layout.setOrientation(LinearLayout.VERTICAL);
		myView = new MyView(this);
		LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(200, 200);
		param.topMargin = 10;
		param.leftMargin = 10;
		layout.addView(myView, param);
		
		mButton = new Button(this);
		mButton.setOnClickListener(this);
		mButton.setText("Exit");
//		mButton.setBackgroundResource(getResources().getColor(Color.GRAY));
		LinearLayout.LayoutParams param1 = new LinearLayout.LayoutParams(200, 65);
		param1.topMargin = 10;
		param1.leftMargin = 10;
		layout.addView(mButton, param1);
		
		setContentView(layout);
	}

	@Override
	public void onClick(View v)
	{
		finish();
	}
}
